//string 数据删除
#include<iostream>
#include<string>

using namespace std;

int main()
{
    string s1;

    //初始化
    s1="Hello wooooorld";

    //清空字符串，需要提供参数
    s1.erase(7); //从索引7开始删除到字符串末尾
    cout<<s1<<endl;//索引从0开始

    s1="Hello wooooorld";
    s1.erase(7,3);//从索引7开始删除3个字符
    cout<<s1<<endl;

    s1="Hello wooooorld";;
    s1.erase(s1.begin()); //删除第一个字符
    cout<<s1<<endl;

    s1="Hello wooooorld";
    s1.erase(s1.begin()+7,s1.begin()+10);//删除索引7到9的字符
    cout<<s1<<endl;//不会删除第10个

    s1="Hello wooooorld";
    s1.clear();
    cout<<"s1:"<<s1<<endl;
    return 0;
}